home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol E-12
/
(Vol E-12) May 21 2012.iso
/
Animations
/
dj
/
dj.swf
/
scripts
/
__Packages
/
mx
/
controls
/
streamingmedia
/
PlayBarThumb.as
< prev
next >
Wrap
Text File
|
2012-05-21
|
4KB
|
139 lines
class mx.controls.streamingmedia.PlayBarThumb extends MovieClip
{
function PlayBarThumb()
{
super();
this.init();
}
function init()
{
this._playBar = this._parent;
this.__set__enabled(this._playBar.getController().enabled);
}
function isVertical()
{
return this._playBar.isVertical();
}
function handlePress()
{
this.startThumbDrag();
}
function startThumbDrag()
{
this._dragging = true;
var _loc2_ = this._playBar.getController();
_loc2_.broadcastEvent("scrubbing",true);
this._wasPlaying = _loc2_.isPlaying();
if(this._wasPlaying)
{
_loc2_.broadcastEvent("click","pause");
}
this.onMouseMove = this.handleMouseMove;
}
function onUnload()
{
if(this._dragging)
{
this.stopThumbDrag();
}
}
function handleRelease()
{
if(this._dragging)
{
this.stopThumbDrag();
}
}
function handleReleaseOutside()
{
if(this._dragging)
{
this.stopThumbDrag();
}
}
function stopThumbDrag()
{
this._dragging = false;
var _loc2_ = this._playBar.getController();
if(this._wasPlaying)
{
_loc2_.broadcastEvent("click","play");
}
_loc2_.broadcastEvent("scrubbing",false);
delete this.onMouseMove;
}
function handleMouseMove()
{
var _loc2_ = this._playBar.getController();
var _loc8_ = _loc2_.getLoadBar().getCompletionPercentage() / 100;
if(this.isVertical())
{
var _loc6_ = this._playBar.getHeight() - 8;
var _loc9_ = _loc6_ * (1 - _loc8_) - 2;
var _loc3_ = this._playBar._ymouse;
if(_loc3_ < _loc9_)
{
_loc3_ = _loc9_;
}
else if(_loc3_ > _loc6_)
{
_loc3_ = _loc6_;
}
this._y = _loc3_;
}
else
{
var _loc10_ = (this._playBar.getWidth() - 6) * _loc8_;
var _loc4_ = this._playBar._xmouse;
if(_loc4_ < 0)
{
_loc4_ = 0;
}
else if(_loc4_ > _loc10_)
{
_loc4_ = _loc10_;
}
this._x = _loc4_;
}
this._playBar.updateHiliteToMatchThumb();
var _loc5_ = !this.isVertical() ? this._playBar.xToPercent(this._x) : this._playBar.yToPercent(this._y);
if(mx.controls.streamingmedia.StreamingMediaConstants.SCRUBBING)
{
_loc2_.broadcastEvent("playheadChange",_loc5_);
}
var _loc11_ = _loc2_.__get__playTime() * 100 / _loc2_.__get__playPercent();
var _loc7_ = _loc11_ * _loc5_ / 100;
this._playBar.setTime(_loc7_);
_loc2_.__set__playPercent(_loc5_);
_loc2_.__set__playTime(_loc7_);
}
function get enabled()
{
return this._enabled;
}
function set enabled(is)
{
this._enabled = is;
if(is)
{
this.onPress = this.handlePress;
this.onRelease = this.handleRelease;
this.onReleaseOutside = this.handleReleaseOutside;
}
else
{
if(this._dragging)
{
this.stopThumbDrag();
}
delete this.onPress;
delete this.onRelease;
delete this.onReleaseOutside;
}
}
function isScrubbing()
{
return this._dragging;
}
}